import { RouteObject, RouterProvider, createBrowserRouter } from 'react-router-dom'
import { AppRouteObject } from '@/types/router'
import { lazy } from 'react'
import Layout from '@/layouts'

const LoginRoute: AppRouteObject = {
  path: '/login',
  Component: lazy(() => import('@/views/sys/login/Login'))
}

export default function Router() {
  const asyncRoutes: AppRouteObject = {
    path: '/',
    element: <Layout />
  }
  const routes = [LoginRoute, asyncRoutes]
  const router = createBrowserRouter(routes as unknown as RouteObject[])
  return <RouterProvider router={router} />
}
